{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9bd8e49a-29a7-461f-be17-45db53deb06e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd#学入数据\n",
    "train=pd.read_csv(\"data/train.csv\")test=pd.read_csv(\"data/test.csv\")\n",
    "import lightgbm as lgb\n",
    "mode1_lgb= 1gb.LGBMClassifier(\n",
    "num_leaves=2**5-1, reg_alpha=0.25,reg_lambda=0.25, objective='binary'，max_depth=-1,learning_rate=0.005,min_child_samples=3,random_state=2022,n_estimators=2000,subsample=1, colsample_bytree=1,\n",
    ")\n",
    "#模型两练\n",
    "Nu_feature = list(train.select_dtypes(exclude=[ 'object']).columns)#数值变量train_2 = train[Nu_feature]\n",
    "Nu_feature_2 - Nu_feature[e:-1]test_2 = test[Nu_feature_2]\n",
    "model_1gb.fit(train_2.drop(['fraud'], axis=1)，train_2[ 'fraud' ])#AUC平网:以proba进行提交,结果会更好\n",
    "y_pred = model_1gb.predict_proba(test_2)result = pd.read_csv( 'data/submission.csv)result['fraud '] = y_pred[:,1]\n",
    "result.to_esv( 'data/baseline.csv' , index=False)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cca9dc96-c4b9-4b85-86b7-97702f7bbac5",
   "metadata": {},
   "outputs": [],
   "source": [
    "#数据预处理\n",
    "#合并湖练菜和测试集{同时进行数据预处理data - pd.concat([train, test],axis=0)\n",
    "from sklearn.preprocessing import LabelEncoder#标签病码\n",
    "numerical_fea = list(data.select_dtypes(include=[ 'object' ]).columns)division_le = LabelEncoder()\n",
    "for fea in numerical_fea:\n",
    "division_le.fit(data[fea].values)\n",
    "data[fea] = division_le.transform(data[fea].values)#拆分数据集\n",
    "testA=data[data[ 'fraud\" ].isnull()].drop([ \"fraud' ],axis=1)trainA=data[data[ \"fraud  ].notnul1(]\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
